![Malicious npm Package Typosquats react-login-page to Deploy Keylogger](https://cdn.sanity.io/images/cgdhsj6q/production/007b21d9cf9e03ae0bb3f577d1bd59b9d715645a-1024x1024.webp?w=400&fit=max&auto=format)
Research
Security News
Malicious npm Package Typosquats react-login-page to Deploy Keylogger
Socket researchers unpack a typosquatting package with malicious code that logs keystrokes and exfiltrates sensitive data to a remote server.
clone-stats
Advanced tools
Package description
The clone-stats npm package is designed to clone the stats from one fs.Stats instance to another. This is particularly useful when you're working with file system operations in Node.js and need to replicate file or directory statistics accurately without modifying the original stats object. It provides a straightforward and efficient way to copy stats, ensuring that all the properties are cloned correctly.
Cloning fs.Stats instance
This code demonstrates how to clone the statistics of a file system object using clone-stats. It first requires the clone-stats and fs modules. Then, it uses fs.stat to get the stats of a specific file and clone-stats to clone these stats into a new variable, allowing for manipulation or comparison without affecting the original stats object.
const cloneStats = require('clone-stats');
const fs = require('fs');
fs.stat('/path/to/file', (err, stats) => {
if (err) throw err;
const clonedStats = cloneStats(stats);
console.log(clonedStats);
});
The clone package offers a more general cloning functionality that can be used not only for fs.Stats objects but for cloning any JavaScript objects. It provides deep cloning capabilities, which means it can clone nested objects as well. Compared to clone-stats, clone is more versatile but might be overkill for specific use cases where only fs.Stats objects need to be cloned.
Similar to the clone package, clone-deep offers deep cloning functionality for JavaScript objects. It ensures that even deeply nested properties are cloned. While clone-deep is powerful for a wide range of objects, clone-stats is specifically optimized for fs.Stats objects, potentially making it more efficient for that particular use case.
Readme
Safely clone node's
fs.Stats
instances without
losing their class methods, i.e. stat.isDirectory()
and co.
copy = require('clone-stats')(stat)
Returns a clone of the original fs.Stats
instance (stat
).
MIT. See LICENSE.md for details.
FAQs
Unknown package
We found that clone-stats demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers unpack a typosquatting package with malicious code that logs keystrokes and exfiltrates sensitive data to a remote server.
Security News
The JavaScript community has launched the e18e initiative to improve ecosystem performance by cleaning up dependency trees, speeding up critical parts of the ecosystem, and documenting lighter alternatives to established tools.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.